import { UserModel } from "@/database";
import type { User } from "~/type";
import { getHeader } from "h3";


/**
 * 用户信息
 * @url /api/v1/getUserInfo
 * @method GET
 */
export default defineEventHandler(async (event) => {

    const query = getQuery(event)
    const userId = query.user_id as string
    if (!userId) {
        return failApi('用户id不能为空')
    }
    const user = UserModel.find(item => item.id === +userId)
    if (!user) return failApi('用户不存在')
    return successApi('获取成功', user)
})